﻿namespace LetsTiltWPFFirstSample
{
    using System.Windows;
    using System.Windows.Input;

    public partial class MainWindow
    {
        private readonly MainViewModel viewModel;

        public MainWindow()
        {
            InitializeComponent();
            this.viewModel = new MainViewModel();
            this.DataContext = viewModel;

            this.Loaded += MainWindow_Loaded;
        }

        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            this.viewModel.Element = this.TestButton;
        }

        private void UIElement_OnMouseMove(object sender, MouseEventArgs e)
        {
            this.viewModel.CursorCoordinates = e.GetPosition(this.TestButton);
        }
    }
}
